package cn.jly.spring.annotation.listener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

/**
 * @author lanyangji
 * @description 测试普通类去监听事件
 * @date 2020/11/14 上午 11:26
 */
@Service
public class UserService {

    @EventListener(classes = {ApplicationEvent.class})
    public void listen(ApplicationEvent event){
        System.out.println("UserService.listen --> 监听到的事件 --> " + event);
    }
}
